<!DOCTYPE html>
<%@page pageEncoding="UTF-8"%>
<html>
<!-- 
  - Author(s): waffie
  - Date: 2020-08-21 15:55:35
  - Description:
-->
<head>
<title>项目计划信息</title>
<%@include file="/resource/template1.jsp"%>
</head>
<body class="formBody">
<div class="toolbar">
    <a class="nui-button" iconCls="icon-save" plain="true" onclick="validateForm">保存</a>
    <span class="separator"></span>
    <a class="nui-button" iconCls="icon-cancel" plain="true">关闭</a>
</div><!-- toolBar -->

<div class="form-title">项目计划信息</div>
<div class="form-cont">
<form id="pageForm" method="post">
	<table class="form-table">
		<tr class="bor">
			<th>计划名称</th>
			<td>
				<input name="planName" class="nui-textbox" required="true" style="width:90%;" />
			</td>
			<th>计划编码<span class="btx">*</span></th>
			<td>
				<input name="planCode" class="nui-textbox" required="true" style="width:90%;" />
			</td>
		</tr>
		<tr class="bor">
			<th>计划开始时间<span class="btx">*</span></th>
			<td>
				<input name="dateBegin" class="nui-datepicker" value="2020-08-20" required="true" />
			</td>
			<th>计划结束时间<span class="btx">*</span></th>
			<td>
				<input name="dateEnd" class="nui-datepicker" value="" required="true" />
			</td>
		</tr>
		<tr class="bor">
			<th>计划描述</th>
			<td colspan="3">
				<input name="remarks" class="nui-textarea" required="true" style="width:95%;" />
			</td>
		</tr>
	</table>
</form>
<script type="text/javascript">
nui.parse();

// 页面加载完成后执行
$(function(){
});

// 获取表单数据
var getForm = function() {
    var form = new nui.Form("#pageForm");
    var data = form.getData(true, false);
    var s = nui.encode(data);
    //form.setIsValid(false);
}

// 设置表单数据
var setForm = function() {
    var obj = {
        String: "abc",
        Date: "2020-11-12",
        Boolean: 'Y',
        TreeSelect: "ajax",
        countrys: "cn",
        //countrys2: "de",
        countrys3: "usa"
    };
    var form = new nui.Form("#pageForm");
    form.setData(obj, false);
}

// 重置表单数据
var resetForm = function() {
    var form = new nui.Form("#pageForm");
    form.reset();
}

// 清空表单数据
var clearForm = function() {
    var form = new nui.Form("#pageForm");
    form.clear();
}

// 提交表单数据
var submitForm = function() {
    var form = new nui.Form("#pageForm");            
    var data = form.getData(); //获取表单多个控件的数据
    var json = nui.encode(data); //序列化成JSON
    $.ajax({
        url: "../data/FormService.aspx?method=SaveData",
        type: "post",
        data: { submitData: json },
        success: function (text) {
            alert("提交成功，返回结果:" + text);
        }
    });
}

// 加载表单数据
var loadForm = function() {
    var form = new nui.Form("#pageForm");            
    $.ajax({
        url: "../data/FormService.aspx?method=LoadData",
        type: "post",
        success: function (text) {
            var data = nui.decode(text);//反序列化成对象
            form.setData(data);//设置多个控件数据
        }
    });
}

// 表单数据校验
var validateForm = function() {
    var form = new nui.Form("#pageForm");
    form.validate();
    if (form.isValid() == false) return;
}
</script>
</body>
</html>